<template>
  <div>
<h1>插槽演示</h1>
<GuanLi>
  <template v-slot="data">
    <input type="button" value="删除" @click="isdel(data)"/>
  </template>
</GuanLi>
  </div>
</template>

<script setup lang="ts">
import GuanLi from './GuanLi.vue'
import { reactive, toRefs, onMounted } from 'vue';
import axios from 'axios';
import { useRoute, useRouter } from 'vue-router';
const router = useRouter();
const route = useRoute();

//删除
const isdel=(data:any)=>{
  const f=confirm('确认删除吗？');
  if(f){
    axios({
      url:'/api/Borrow/GetDel',
      method:'get',
      params:{
        B_Id:data.data
      }
    })
    .then(res=>{
      if(res.data.data==-1){
        alert('有人借款不能删除');
        return;
      }
      else{
        alert('删除成功');
        router.go(0);
      }
    })
  }
}
</script>

<style scoped>

</style>